//
//  BaseViewController.m
//  KMedicine
//
//  Created by 曹牧 on 16/7/5.
//  Copyright © 2016年 caomu. All rights reserved.
//

#import "BaseViewController.h"
#import "HomeViewController.h"

@interface BaseViewController ()

@end

@implementation BaseViewController


//  ***********************【 主界面的搭建 】**********************

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = WHITE_COLOR;
    
    self.navigationController.navigationBar.barTintColor = kThemeColor;
    [self setupLeftButtonItem];
    
}

#pragma mark -
#pragma mark - 修改了左上角的item值
- (void)setupLeftButtonItem{
    
    UIButton * leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    
    [leftBtn setImage:[UIImage imageNamed:@"JianTou"] forState:UIControlStateNormal];
    
    [leftBtn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
}

#pragma mark -
#pragma mark - 返回上一个控制器
- (void)goBack{
    [self.navigationController popViewControllerAnimated:YES];
}

//  ***********************【 侧滑 】**********************

#pragma mark -
#pragma mark - 中间的nav(getter)
- (UINavigationController *)centerNavigationController{
    return (UINavigationController *)self.sidePanelController.centerPanel;
}

#pragma mark -
#pragma mark - left view(getter)
- (UIViewController *)leftMenuViewController{
    return self.sidePanelController.leftPanel;
}

- (void)jumpToOtherViewController:(UIViewController *)otherVC{
    
    //显示中间的控制器(JAS method)
    [self.sidePanelController showCenterPanelAnimated:YES];

    //push到指定的VC
    [[self centerNavigationController] pushViewController:otherVC animated:NO];
    
}


@end
